/*
 *  $Id: Eruption.cs 939 2009-12-03 13:12:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Fire.Abilities {
    public class Eruption: AbilityCard<Land> {
        public Eruption(): base("001_f_a_eruption") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Fire;
            Target = new LandTarget(GetTargetPhrase(), true, false, IsNotVolcano);
        }

        private static bool IsNotVolcano(TargetRequest request, Land land) { return !(land.Card is Lands.Volcano); }

        protected override void DoAction(TargetArgs<Land> args) {
            args.Target.Remove();
            EruptionAffect affect = args.Caster.GetAffect<EruptionAffect>();
            int value = 1;
            if (affect != null) {
                value += affect.Value;
                args.Caster.RemoveAffect(affect);
            }
            args.Caster.AddAffect(new EruptionAffect(value));
        }

        public class EruptionAffect: SpellAffect<Eruption> {
            public readonly int Value;

            public EruptionAffect(int value): base(true) {
                DefaultDescription = true;
                Value = value;
                Add(new Affects.ManaIncome(ElementType.Fire, value));
            }

            public override string DescriptionText {
                get { return Description.GetText(Value); }
            }

            public override bool Dispellable {
                get { return false; }
            }

            public override Affect Clone() {
                return new EruptionAffect(Value);
            }
        }
    }
}
